package creators;


import physicalobjects.FixedMass;
import physicalobjects.Mass;
import simulationhandlers.Simulation;

/**
 * Creates a mass.
 * @author Kathleen Lan, Seon Kang
 */

public class MassCreator extends Creator {
    private String myCreatorName = "mass";


    /**
     * @param sim 
     * @param assemblyNumber 
     */
    public MassCreator (Simulation sim, int assemblyNumber) {
        super(sim, assemblyNumber);
        setName(myCreatorName);
    }

    /**
     * @return
     */
    public Mass createMyObject() {
        int id = scannerNextInt();
        double x = scannerNextDouble();
        double y = scannerNextDouble();
        double mass = scannerNextDouble();
        if (mass < 0) {
            return new FixedMass(id, x, y, mass);
        }
        return new Mass(id, x, y, mass);
    }

}
